<template>
	<view class="content">
		<u-navbar title="设置" placeholder></u-navbar>
		<view class="listPage">
			<view class="botList" v-for="(item,index) in data.list" :key="item.id" @tap="toset(item.id)">
				<text :style="item.fontColor? 'color:red':''">{{item.name}}</text>
				<u-icon name="arrow-right" color="#867F7F" size="28"></u-icon>
			</view>
			<view class="btnBox">
				<button @tap="data.loginshow=true">退出登录</button>
			</view>

		</view>
		<u-modal v-model="data.loginshow" title="系统提示" content="确定要退出吗？更多好工作，尽在微靖江人才网" confirmText="确定" showCancelButton
			@confirm="confirm"></u-modal>
	</view>
</template>

<script setup>
	import {
		useUserStore
	} from '/stores/userInfo.js'
	import {
		reactive
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	const useUser = useUserStore()
	const data = reactive({
		list: [{
				name: "账号认证",
				id: "account"
			},
			{
				name: "常用语设置",
				id: "useful"
			},
			// #ifdef APP-PLUS
			{
				name: "权限管理",
				id: "jurisdiction"
			},
			// #endif
			{
				name: "关于",
				id: "regard"
			},
			{
				name: "切换身份",
				id: "cut"
			},
			{
				name: "注销账号",
				id: "off",
				fontColor: true
			}
		],
		loginshow: false
	})
	onLoad(() => {
		if (uni.getStorageSync('utype') == 1) {
			data.list.splice(1, 0, {
				name: '企业认证',
				id: 'auth'
			})
		}
	})
	// 退出账号
	const confirm = () => {
		uni.$u.toast('退出成功')
		useUser.getLogout()
	}
	const toset = (i) => {
		switch (i) {
			case "account":
				uni.$u.route('pages/pagesPersonal/set/bindaccount/bindaccount')
				break;
			case "auth":
				uni.$u.route('pages/pagesPersonal/set/auth/auth')
				break;
			case "useful":
				uni.$u.route('pages/pagesMessage/commonPhrases/index')
				break;
			case "jurisdiction":
				uni.$u.route('pages/pagesPersonal/set/rights/rights')
				break;
			case "regard":
				uni.$u.route('pages/pagesPersonal/set/about/about')
				break;
			case "cut":
				uni.$u.route('pages/pagesPersonal/set/identity/identity')
				break;
			case "off":
				uni.$u.route('pages/pagesPersonal/set/logOff/logOff')
				break;
		}
	}
</script>

<style lang="scss">
	.content {
		width: 100%;
		height: 100%;
		background-color: #fff;
		padding: 0 30rpx;
		border-top: 2rpx solid #ccc;

		.listPage {
			.botList {
				height: 120rpx;
				width: 100%;
				border-bottom: 1rpx solid #ccc;
				display: flex;
				justify-content: space-between;
				align-items: center;

				text {
					font-size: 28rpx;
					font-weight: bold;
				}
			}
		}

		.btnBox {
			width: 100%;
			height: 100rpx;
			display: flex;
			align-items: center;

			button {

				width: 690rpx;
				height: 76rpx;
				line-height: 76rpx;
				border-radius: 6rpx;
				background-color: rgba(239, 239, 239, 1);
				color: rgba(16, 16, 16, 1);
				font-size: 28rpx;
				text-align: center;
				font-family: Arial;

				&::after {
					border: none;
				}

			}
		}

	}
</style>